Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@salesforce/sf-plugins-core

Package Overview
Dependencies
Maintainers
0
Versions
299
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@salesforce/sf-plugins-core

Utils for writing Salesforce CLI plugins

  • 11.3.12
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
906K
decreased by-39.09%
Maintainers
0
Weekly downloads
 
Created

What is @salesforce/sf-plugins-core?

@salesforce/sf-plugins-core is a core library for building Salesforce CLI plugins. It provides a set of utilities and base classes to streamline the development of plugins for the Salesforce CLI, enabling developers to create commands, handle user input, manage configuration, and interact with Salesforce APIs.

What are @salesforce/sf-plugins-core's main functionalities?

Command Base Class

The Command Base Class feature allows developers to create new CLI commands by extending the SfCommand class. This provides a structured way to define command behavior and output.

const { SfCommand } = require('@salesforce/sf-plugins-core');

class MyCommand extends SfCommand {
  async run() {
    this.log('Hello, Salesforce CLI!');
  }
}

module.exports = MyCommand;

User Input Handling

User Input Handling feature allows developers to define and parse command-line flags and arguments using the Flags utility. This makes it easy to handle user input in a consistent manner.

const { SfCommand, Flags } = require('@salesforce/sf-plugins-core');

class MyCommand extends SfCommand {
  static flags = {
    name: Flags.string({ char: 'n', description: 'name to print' })
  };

  async run() {
    const { flags } = this.parse(MyCommand);
    this.log(`Hello, ${flags.name}!`);
  }
}

module.exports = MyCommand;

Configuration Management

Configuration Management feature provides utilities to load and manage configuration settings for the CLI. This helps in maintaining consistent configuration across different commands and plugins.

const { SfCommand, Config } = require('@salesforce/sf-plugins-core');

class MyCommand extends SfCommand {
  async run() {
    const config = await Config.load();
    this.log(`Current config: ${JSON.stringify(config)}`);
  }
}

module.exports = MyCommand;

Salesforce API Interaction

Salesforce API Interaction feature allows developers to easily create connections to Salesforce and perform API operations such as queries. This simplifies the process of interacting with Salesforce data from CLI commands.

const { SfCommand, Connection } = require('@salesforce/sf-plugins-core');

class MyCommand extends SfCommand {
  async run() {
    const conn = await Connection.create({ authInfo: this.authInfo });
    const result = await conn.query('SELECT Id, Name FROM Account');
    this.log(`Fetched ${result.records.length} accounts`);
  }
}

module.exports = MyCommand;

Other packages similar to @salesforce/sf-plugins-core

FAQs

Package last updated on 06 Oct 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc